home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / begincpp.zip / #2.C < prev    next >
Text File  |  1990-07-31  |  3KB  |  106 lines

  1. #line 1 "#2.cxx"
  2. void *_new(long);
  3. void _delete(void*);
  4. void *_vec_new(void*,int,int,void*(*)(void*));
  5. void _vec_delete(void*,int,int,void(*)(void*,int),...);
  6. void exit(int);
  7. static void cdecl _STI();
  8. static void cdecl _STD();
  9.  
  10.  
  11.  
  12. struct boolean { 
  13.      int *_boolean_var ;
  14. } ;
  15.  
  16. struct no_constructor { 
  17.      int _no_constructor_none ;
  18. } ;
  19.  
  20. struct no_destructor { 
  21.      int _no_destructor_none ;
  22. } ;
  23.  
  24. struct nothing { char _dummy; } ;
  25.  
  26. void proc1 (void );
  27. void proc2 (void );
  28.  
  29. int main ()
  30.      { 
  31.           int _au1_yes ;
  32.           struct boolean _au1_test ;
  33.           struct no_constructor _au1_x1 ;
  34.           struct no_destructor _au1_x2 ;
  35.           struct nothing _au1_x3 ;
  36.           
  37.           _au1_yes = 1;
  38.  
  39.         //will analyze the following 4 lines:
  40.           ( ( ((& _au1_test )-> _boolean_var 
  41.                     = (((int *)_new ( (long )(sizeof (int ))) ))), 
  42.                          ( ((*(& _au1_test )-> _boolean_var )= _au1_yes ), 
  43.                          (((& _au1_test )))) ) ) ;
  44.  
  45.           /* rearrange the above code into:
  46.           ( ( 
  47.                  (
  48.                       (& _au1_test )-> _boolean_var 
  49.                       = ((
  50.                                 (int *)_new ( (long )(sizeof (int )) ) 
  51.                         ))
  52.                  ),
  53.  
  54.                  (    
  55.                       ((*(& _au1_test )-> _boolean_var )= _au1_yes ), 
  56.                        (((& _au1_test )))
  57.                  ) 
  58.           ) ) ;
  59.           */
  60.  
  61.           ( (((& _au1_x2 )))) ;         //constructor called for x2
  62.  
  63.           proc1 ( ) ;
  64.           proc2 ( ) ;
  65.  
  66.           exit ( (int )0 ) ;
  67.           
  68.           ( (( (( (0 ), 0 ) ), 0 ) ), 0 ) ;    
  69.           
  70.           ( (( ( ( _delete ( (void *)(& _au1_test )-> _boolean_var ) , 0 ) , 
  71.                               (( (0 ), 0 ) )) , 0 ) ), 0 ) ;
  72.      }  
  73.      exit ( 0 ); 
  74. }
  75.  
  76. extern void proc1 ()
  77.      struct boolean _au1_y ;
  78.      
  79.      ( ( ((& _au1_y )-> _boolean_var = 
  80.                (((int *)_new ( (long )(sizeof (int ))) ))), 
  81.                ( ((*(& _au1_y )-> _boolean_var )= 0), (((& _au1_y )))) ) ) ;
  82.  
  83.      { 
  84.           ( (( ( ( _delete ( (void *)(& _au1_y )-> _boolean_var ) , 0 ) , 
  85.                               (( (0 ), 0 ) )) , 0 ) ), 0 ) ;
  86.  
  87.           return ;
  88.      } 
  89.  
  90. extern void proc2 ()
  91.      extern struct boolean z (void );
  92.  
  93.      return ;
  94.  
  95. /* Ignore the warning messages from the translator, 
  96. "#2.cxx", line 15: warning: no_constructor  has destructor but no constructor
  97. "#2.cxx", line 33: warning:  near cdecl x1 not used
  98. "#2.cxx", line 35: warning:  near cdecl x3 not used
  99.  */
  100.  
  101.